package com.g2one.gtunes

import grails.test.*

class SongTests extends GrailsUnitTestCase {
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testSomething() {

    }
	
	void testMinimunDuration() {
		
		// mock the behavior of the Song domain class
		mockDomain(Song)
		
		// create a Song with an invalid duration
		def song = new Song(duration: 0)
		
		// make sure that validation fails
		assertFalse 'validation should have faild', song.validate()
		
		// make sure that validation failed for the expected reason
		assertEquals "min", song.errors.duration
	}
}
